<script type="text/javascript">
  $(document).ready(function() {
    $('#print').click(function() {
      window.location = "<?php echo url_for('printtemplate/assignees').'?appId='.$appId ?>";
    });
  });
</script>
<?php if(count($assignees) > 0): ?>
<p>
  <button class="blue" id="print">Print</button>
</p>
<table>
  <thead>
    <tr>
  <?php foreach($assignees[0] as $key=>$val): ?>
      <th style="padding:5px 20px"><?php echo $key ?></th>
  <?php endforeach; ?>
    </tr>
  </thead>
  <tbody>
    <?php foreach($assignees as $assignee): ?>
    <tr>
        <?php foreach($assignee as $key=>$val): ?>
          <?php if(in_array($key,array('idd','international_roaming','gprs_mobile_data'))): ?>
            <?php $val = ($val == 1) ? 'YES' : 'NO' ?>
          <?php endif; ?>
          <td style="padding:5px 20px"><?php echo $val ?></td>
        <?php endforeach; ?>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
<?php else: ?>
<p>No assignees found for this application.</p>
<?php endif; ?>

